﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using C1.Win.C1Input;
    using Excel;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Diagnostics;
    using System.Drawing;
    using System.Drawing.Printing;
    using System.Reflection;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_RptSoNhatKyMuaHang : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("AdvTaiKhoan")]
        private ADVAccount _AdvTaiKhoan;
        [AccessedThroughProperty("CmdExel")]
        private System.Windows.Forms.Button _CmdExel;
        [AccessedThroughProperty("CmdOK")]
        private System.Windows.Forms.Button _CmdOK;
        [AccessedThroughProperty("CmdPrint")]
        private System.Windows.Forms.Button _CmdPrint;
        [AccessedThroughProperty("Label1")]
        private System.Windows.Forms.Label _Label1;
        [AccessedThroughProperty("Label13")]
        private System.Windows.Forms.Label _Label13;
        [AccessedThroughProperty("Label2")]
        private System.Windows.Forms.Label _Label2;
        [AccessedThroughProperty("Label3")]
        private System.Windows.Forms.Label _Label3;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("Panel3")]
        private Panel _Panel3;
        [AccessedThroughProperty("Panel4")]
        private Panel _Panel4;
        [AccessedThroughProperty("TxtDenNgay")]
        private DateTimePicker _TxtDenNgay;
        [AccessedThroughProperty("TxtTongSoTien")]
        private C1NumericEdit _TxtTongSoTien;
        [AccessedThroughProperty("txtTongTienHangHoa")]
        private C1NumericEdit _txtTongTienHangHoa;
        [AccessedThroughProperty("TxtTongTienNguyenVatLieu")]
        private C1NumericEdit _TxtTongTienNguyenVatLieu;
        [AccessedThroughProperty("TxtTuNgay")]
        private DateTimePicker _TxtTuNgay;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private bool mAllowAdd;
        private bool mAllowDel;
        private bool mAllowEdit;
        private bool mAllowView;
        private clsDMTaiKhoan objTK;

        public Frm_RptSoNhatKyMuaHang()
        {
            base.Load += new EventHandler(this.Frm_RptSoNhatKyMuaHang_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.objTK = new clsDMTaiKhoan();
            this.InitializeComponent();
        }

        private void CmdExel_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog dialog = new SaveFileDialog {
                    Filter = "Excel Files|*.xls",
                    Title = "Save an Excel file"
                };
                dialog.ShowDialog();
                if (dialog.FileName != "")
                {
                    this.VSlist.SaveExcel(dialog.FileName, "NhatKyMuaHang", FileFlags.IncludeFixedCells);
                    Excel.Application application = new ApplicationClass();
                    Workbook workbook = application.Workbooks.Open(dialog.FileName, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
                    Excel.Application application2 = application;
                    application2.get_Range("A1:I4", Missing.Value).Select();
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 5 }, null, null, null), null, "LineStyle", new object[] { -4142 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 6 }, null, null, null), null, "LineStyle", new object[] { -4142 }, null, null, false, true);
                    object instance = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 7 }, null, null, null);
                    NewLateBinding.LateSetComplex(instance, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(instance, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(instance, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    instance = null;
                    object obj3 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 8 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj3, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj3, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj3, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    obj3 = null;
                    object obj4 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 9 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj4, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj4, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj4, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    obj4 = null;
                    object obj5 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 10 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj5, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj5, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj5, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    obj5 = null;
                    object obj6 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 11 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj6, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj6, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj6, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    obj6 = null;
                    object obj7 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 12 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj7, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj7, null, "Weight", new object[] { 2 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj7, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    obj7 = null;
                    application2.Cells.Select();
                    object obj8 = NewLateBinding.LateGet(application2.Selection, null, "Font", new object[0], null, null, null);
                    NewLateBinding.LateSetComplex(obj8, null, "Name", new object[] { "Times New Roman" }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Size", new object[] { 10 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Strikethrough", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Superscript", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Subscript", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "OutlineFont", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Shadow", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "Underline", new object[] { -4142 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj8, null, "ThemeFont", new object[] { 0 }, null, null, false, true);
                    obj8 = null;
                    application2.get_Range("A2:A3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("A1:A3", Missing.Value).Select();
                    object selection = application2.Selection;
                    NewLateBinding.LateSetComplex(selection, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(selection, null, "MergeCells", new object[] { true }, null, null, false, true);
                    selection = null;
                    application2.get_Range("C1", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("B1:C1", Missing.Value).Select();
                    object obj10 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj10, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj10, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj10 = null;
                    application2.get_Range("B3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("B2:B3", Missing.Value).Select();
                    object obj11 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj11, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj11, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj11 = null;
                    application2.get_Range("C3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("C2:C3", Missing.Value).Select();
                    object obj12 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj12, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj12, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj12 = null;
                    application2.get_Range("D2:D3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("D1:D3", Missing.Value).Select();
                    object obj13 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj13, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj13, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj13 = null;
                    application2.get_Range("F1:H1", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("E1:H1", Missing.Value).Select();
                    object obj14 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj14, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj14, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj14 = null;
                    application2.get_Range("E3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("E2:E3", Missing.Value).Select();
                    object obj15 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj15, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj15, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj15 = null;
                    application2.get_Range("F3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("F2:F3", Missing.Value).Select();
                    object obj16 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj16, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj16, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj16 = null;
                    application2.get_Range("H2", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("G2:H2", Missing.Value).Select();
                    object obj17 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj17, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj17, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj17 = null;
                    application2.get_Range("I2:I3", Missing.Value).Select();
                    NewLateBinding.LateCall(application2.Selection, null, "ClearContents", new object[0], null, null, null, true);
                    application2.get_Range("I1:I3", Missing.Value).Select();
                    object obj18 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj18, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj18, null, "MergeCells", new object[] { true }, null, null, false, true);
                    obj18 = null;
                    application2.get_Range("A5:I" + this.VSlist.Rows.Count.ToString(), Missing.Value).Select();
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 5 }, null, null, null), null, "LineStyle", new object[] { -4142 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 6 }, null, null, null), null, "LineStyle", new object[] { -4142 }, null, null, false, true);
                    object obj19 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 7 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj19, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj19, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj19, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj19, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj19 = null;
                    object obj20 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 8 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj20, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj20, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj20, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj20, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj20 = null;
                    object obj21 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 9 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj21, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj21, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj21, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj21, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj21 = null;
                    object obj22 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 10 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj22, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj22, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj22, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj22, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj22 = null;
                    object obj23 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 11 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj23, null, "LineStyle", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj23, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj23, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj23, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj23 = null;
                    object obj24 = NewLateBinding.LateGet(application2.Selection, null, "Borders", new object[] { 12 }, null, null, null);
                    NewLateBinding.LateSetComplex(obj24, null, "LineStyle", new object[] { -4118 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj24, null, "ColorIndex", new object[] { -4105 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj24, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj24, null, "Weight", new object[] { 2 }, null, null, false, true);
                    obj24 = null;
                    application2.get_Range("C" + Conversions.ToString((int) (this.VSlist.Rows.Count + 2)), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "- Sổ n\x00e0y c\x00f3 ........ trang, đ\x00e1nh số từ trang 01 đến trang ........";
                    application2.get_Range("C" + Conversions.ToString((int) (this.VSlist.Rows.Count + 3)), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "- Ng\x00e0y mở sổ:";
                    int num = this.VSlist.Rows.Count + 4;
                    application2.get_Range("F" + num.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Ng\x00e0y        th\x00e1ng        năm " + LVYModule.sRight(this.TxtDenNgay.Text, 4);
                    int num2 = this.VSlist.Rows.Count + 4;
                    num = this.VSlist.Rows.Count + 4;
                    application2.get_Range("F" + num2.ToString().Trim() + ":I" + num.ToString().Trim(), Missing.Value).Select();
                    object obj25 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj25, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj25, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj25 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("F" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Gi\x00e1m đốc";
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("F" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "(K\x00fd, họ t\x00ean, đ\x00f3ng dấu)";
                    num = this.VSlist.Rows.Count + 5;
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("F" + num.ToString().Trim() + ":I" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj26 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj26, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj26, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj26 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num = this.VSlist.Rows.Count + 6;
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("F" + num.ToString().Trim() + ":I" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj27 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj27, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj27, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj27 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("D" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Kế to\x00e1n trưởng";
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("D" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "(K\x00fd, họ t\x00ean)";
                    num = this.VSlist.Rows.Count + 5;
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("D" + num.ToString().Trim() + ":E" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj28 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj28, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj28, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj28 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num = this.VSlist.Rows.Count + 6;
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("D" + num.ToString().Trim() + ":E" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj29 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj29, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj29, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj29 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("A" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Người ghi sổ";
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("A" + num2.ToString().Trim(), Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "(K\x00fd, họ t\x00ean)";
                    num = this.VSlist.Rows.Count + 5;
                    num2 = this.VSlist.Rows.Count + 5;
                    application2.get_Range("A" + num.ToString().Trim() + ":C" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj30 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj30, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj30, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj30 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    num = this.VSlist.Rows.Count + 6;
                    num2 = this.VSlist.Rows.Count + 6;
                    application2.get_Range("A" + num.ToString().Trim() + ":C" + num2.ToString().Trim(), Missing.Value).Select();
                    object obj31 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj31, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj31, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj31 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    NewLateBinding.LateCall(application2.Rows["1:3", Missing.Value], null, "Select", new object[0], null, null, null, true);
                    application2.get_Range("A3", Missing.Value).Activate();
                    NewLateBinding.LateCall(NewLateBinding.LateGet(application2.Rows["1:3", Missing.Value], null, "EntireRow", new object[0], null, null, null), null, "AutoFit", new object[0], null, null, null, true);
                    NewLateBinding.LateCall(application2.Rows["1:3", Missing.Value], null, "Select", new object[0], null, null, null, true);
                    NewLateBinding.LateCall(application2.Selection, null, "Insert", new object[] { -4121, 0 }, new string[] { "Shift", "CopyOrigin" }, null, null, true);
                    NewLateBinding.LateCall(application2.Selection, null, "Insert", new object[] { -4121, 0 }, new string[] { "Shift", "CopyOrigin" }, null, null, true);
                    NewLateBinding.LateCall(application2.Rows["1:2", Missing.Value], null, "Select", new object[0], null, null, null, true);
                    NewLateBinding.LateCall(application2.Selection, null, "Insert", new object[] { 0x1019, 0 }, new string[] { "Shift", "CopyOrigin" }, null, null, true);
                    application2.get_Range("D3", Missing.Value).Select();
                    application2.get_Range("A1", Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Đơn vị:" + modGeneral.H_COMPANYNAMEVIET;
                    application2.get_Range("A2", Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Địa chỉ:" + modGeneral.H_ADDRESSVIET;
                    application2.get_Range("G2", Missing.Value).Select();
                    if (modGeneral.H_PHIENBANQUYETDINH == "QD15")
                    {
                        application2.ActiveCell.FormulaR1C1 = "Mẫu số S03a3-DN";
                    }
                    else
                    {
                        application2.ActiveCell.FormulaR1C1 = "Mẫu số S03a3-DNN";
                    }
                    application2.get_Range("G2:I2", Missing.Value).Select();
                    object obj32 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj32, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj32, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj32 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    application2.get_Range("G3", Missing.Value).Select();
                    if (modGeneral.H_PHIENBANQUYETDINH == "QD15")
                    {
                        application2.ActiveCell.FormulaR1C1 = "(Ban h\x00e0nh theo QĐ số 15/2006/QĐ-BTC";
                    }
                    else
                    {
                        application2.ActiveCell.FormulaR1C1 = "(Ban h\x00e0nh theo QĐ số 48/2006/QĐ-BTC";
                    }
                    application2.get_Range("G3:I3", Missing.Value).Select();
                    object obj33 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj33, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj33, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj33 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    application2.get_Range("G4", Missing.Value).Select();
                    if (modGeneral.H_PHIENBANQUYETDINH == "QD15")
                    {
                        application2.ActiveCell.FormulaR1C1 = "ng\x00e0y 20/03/2006 của Bộ trưởng Bộ t\x00e0i ch\x00ednh)";
                    }
                    else
                    {
                        application2.ActiveCell.FormulaR1C1 = "ng\x00e0y 14/06/2006 của Bộ trưởng Bộ t\x00e0i ch\x00ednh)";
                    }
                    application2.get_Range("G4:I4", Missing.Value).Select();
                    object obj34 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj34, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj34, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj34 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    application2.get_Range("B6", Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "SỔ NHẬT K\x00dd MUA H\x00c0NG";
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Font", new object[0], null, null, null), null, "Bold", new object[] { true }, null, null, false, true);
                    object obj35 = NewLateBinding.LateGet(application2.Selection, null, "Font", new object[0], null, null, null);
                    NewLateBinding.LateSetComplex(obj35, null, "Name", new object[] { "Times New Roman" }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Size", new object[] { 0x10 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Strikethrough", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Superscript", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Subscript", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "OutlineFont", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Shadow", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "Underline", new object[] { -4142 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "ColorIndex", new object[] { 1 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "TintAndShade", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj35, null, "ThemeFont", new object[] { 0 }, null, null, false, true);
                    obj35 = null;
                    application2.get_Range("A6:I6", Missing.Value).Select();
                    object obj36 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj36, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj36, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj36 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    NewLateBinding.LateCall(NewLateBinding.LateGet(application2.Rows["6:6", Missing.Value], null, "EntireRow", new object[0], null, null, null), null, "AutoFit", new object[0], null, null, null, true);
                    string str = "";
                    if ((LVYModule.sLeft(this.TxtTuNgay.Text, 5) == "01/01") & (LVYModule.sLeft(this.TxtDenNgay.Text, 5) == "31/12"))
                    {
                        str = modGeneral.Tranlated("Năm", "") + " " + LVYModule.sRight(this.TxtTuNgay.Text, 4);
                    }
                    else
                    {
                        str = modGeneral.Tranlated("Từ ng\x00e0y", "") + " :" + this.TxtTuNgay.Text + " " + modGeneral.Tranlated("đến ng\x00e0y", "") + ":" + this.TxtDenNgay.Text;
                    }
                    application2.get_Range("A7", Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = str;
                    NewLateBinding.LateSetComplex(NewLateBinding.LateGet(application2.Selection, null, "Font", new object[0], null, null, null), null, "Bold", new object[] { true }, null, null, false, true);
                    application2.get_Range("A7:I7", Missing.Value).Select();
                    object obj37 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj37, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj37, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj37 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    application2.get_Range("A8", Missing.Value).Select();
                    application2.ActiveCell.FormulaR1C1 = "Đơn vị t\x00ednh:đồng";
                    application2.get_Range("A8:I8", Missing.Value).Select();
                    object obj38 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj38, null, "HorizontalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "VerticalAlignment", new object[] { -4108 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "WrapText", new object[] { true }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj38, null, "MergeCells", new object[] { false }, null, null, false, true);
                    obj38 = null;
                    NewLateBinding.LateCall(application2.Selection, null, "Merge", new object[0], null, null, null, true);
                    object obj39 = application2.Selection;
                    NewLateBinding.LateSetComplex(obj39, null, "HorizontalAlignment", new object[] { -4152 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "VerticalAlignment", new object[] { -4107 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "WrapText", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "Orientation", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "AddIndent", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "IndentLevel", new object[] { 0 }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "ShrinkToFit", new object[] { false }, null, null, false, true);
                    NewLateBinding.LateSetComplex(obj39, null, "ReadingOrder", new object[] { -5002 }, null, null, false, true);
                    obj39 = null;
                    application2 = null;
                    application.ActiveWorkbook.Save();
                    application.Visible = true;
                }
            }
            catch (COMException exception1)
            {
                ProjectData.SetProjectError(exception1);
                COMException exception = exception1;
                MessageBox.Show(exception.Message);
                ProjectData.ClearProjectError();
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                MessageBox.Show(exception2.Message);
                ProjectData.ClearProjectError();
            }
        }

        private void CmdOK_Click(object sender, EventArgs e)
        {
            this.ShowData();
        }

        private void CmdPrint_Click(object sender, EventArgs e)
        {
            this.Print();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_RptSoNhatKyMuaHang_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;
            LVYModule.GetUserRight(ref this.mAllowView, ref this.mAllowDel, ref this.mAllowEdit, ref this.mAllowAdd, Conversions.ToString(this.Tag), modGeneral.H_USERNAME);
            if (!this.mAllowView)
            {
                this.Cursor = Cursors.Default;
                LVYModule.ShowWarning(modGeneral.Tranlated("Bạn kh\x00f4ng c\x00f3 quyền xem, li\x00ean hệ với người quản trị để biết th\x00eam chi tiết.", ""));
                this.Dispose();
            }
            else
            {
                this.objTK.LoadByCode("331");
                this.AdvTaiKhoan.Value = this.objTK.Khoa;
                this.TxtTuNgay.Text = "01/" + LVYModule.sRight("00" + Conversions.ToString(DateAndTime.Month(DateAndTime.Today)), 2) + "/" + Conversions.ToString(DateAndTime.Year(DateAndTime.Today));
                this.MergeColumns();
                this.ShowData();
                this.Cursor = Cursors.Default;
            }
        }

        public System.Data.DataTable GetData()
        {
            System.Data.DataTable table;
            string commandText = "";
            string str4 = LVYModule.Date2Char(this.TxtTuNgay.Text);
            string str2 = LVYModule.Date2Char(this.TxtDenNgay.Text);
            string text = this.AdvTaiKhoan.TxtCode.Text;
            commandText = "SELECT dbo.Char2Date(NK.NgayChungTu) as NgayThang, NK.SoChungTu as SoHieu,  dbo.Char2Date(NK.NgayChungTu) as NgayChungTu,NK.DienGiai, NK.KhoaTaiKhoanNo, Rtrim(TKN.SoTaiKhoan) as TaiKhoanNo, NK.KhoaTaiKhoanCo, Rtrim(TKC.SoTaiKhoan) as TaiKhoanCo, NK.SoPhatSinh as SoTien FROM GL_NhatKyChungTu NK LEFT JOIN DM_TaiKhoan TKC ON  NK.KhoaTaiKhoanCo = TKC.Khoa LEFT JOIN DM_TaiKhoan TKN ON  NK.KhoaTaiKhoanNo = TKN.Khoa WHERE TKC.SoTaiKhoan like '" + text + "%' AND (NK.NgayChungTu Between  '" + str4 + "' And '" + str2 + "')ORDER BY NgayThang, SoHieu, SoTien DESC ";
            try
            {
                table = DBHelper.ExecuteDataset(modGeneral.ConnectionString, CommandType.Text, commandText, new IDataParameter[0]).Tables[0];
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message);
                table = null;
                ProjectData.ClearProjectError();
                return table;
                ProjectData.ClearProjectError();
            }
            return table;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_RptSoNhatKyMuaHang));
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel1 = new Panel();
            this.Label2 = new System.Windows.Forms.Label();
            this.AdvTaiKhoan = new ADVAccount();
            this.Label1 = new System.Windows.Forms.Label();
            this.TxtDenNgay = new DateTimePicker();
            this.Label13 = new System.Windows.Forms.Label();
            this.TxtTuNgay = new DateTimePicker();
            this.CmdPrint = new System.Windows.Forms.Button();
            this.CmdOK = new System.Windows.Forms.Button();
            this.CmdExel = new System.Windows.Forms.Button();
            this.Panel2 = new Panel();
            this.Panel3 = new Panel();
            this.Panel4 = new Panel();
            this.txtTongTienHangHoa = new C1NumericEdit();
            this.Label3 = new System.Windows.Forms.Label();
            this.TxtTongTienNguyenVatLieu = new C1NumericEdit();
            this.TxtTongSoTien = new C1NumericEdit();
            this.VSlist.BeginInit();
            this.Panel1.SuspendLayout();
            this.Panel2.SuspendLayout();
            this.Panel3.SuspendLayout();
            this.Panel4.SuspendLayout();
            ((ISupportInitialize) this.txtTongTienHangHoa).BeginInit();
            ((ISupportInitialize) this.TxtTongTienNguyenVatLieu).BeginInit();
            ((ISupportInitialize) this.TxtTongSoTien).BeginInit();
            this.SuspendLayout();
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSlist.ColumnInfo = manager.GetString("VSlist.ColumnInfo");
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.FocusRect = FocusRectEnum.None;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            System.Drawing.Point point = new System.Drawing.Point(0, 0);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 4;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.Fixed = 4;
            this.VSlist.SelectionMode = SelectionModeEnum.Row;
            Size size = new Size(0x3e2, 0x275);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x48;
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Label2);
            this.Panel1.Controls.Add(this.AdvTaiKhoan);
            this.Panel1.Controls.Add(this.Label1);
            this.Panel1.Controls.Add(this.TxtDenNgay);
            this.Panel1.Controls.Add(this.Label13);
            this.Panel1.Controls.Add(this.TxtTuNgay);
            this.Panel1.Controls.Add(this.CmdPrint);
            this.Panel1.Controls.Add(this.CmdOK);
            this.Panel1.Controls.Add(this.CmdExel);
            this.Panel1.Dock = DockStyle.Top;
            point = new System.Drawing.Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            size = new Size(0x3e2, 0x2b);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 0x49;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0xb9, 2);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x37, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 0x7a;
            this.Label2.Text = "T\x00e0i khoản";
            this.AdvTaiKhoan.Conditions = "";
            this.AdvTaiKhoan.DefaultValue = "";
            this.AdvTaiKhoan.FieldNameFilter = "Left(SoTaiKhoan,3)";
            this.AdvTaiKhoan.KeyFilter = "111";
            point = new System.Drawing.Point(0xbc, 0x11);
            this.AdvTaiKhoan.Location = point;
            Padding padding = new Padding(0);
            this.AdvTaiKhoan.Margin = padding;
            this.AdvTaiKhoan.Name = "AdvTaiKhoan";
            this.AdvTaiKhoan.OnlyDigit = false;
            this.AdvTaiKhoan.ReadOnly = false;
            size = new Size(0x131, 20);
            this.AdvTaiKhoan.Size = size;
            this.AdvTaiKhoan.TabIndex = 0x79;
            this.AdvTaiKhoan.UpperText = true;
            this.AdvTaiKhoan.Value = "";
            this.AdvTaiKhoan.WithCode = 80;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new System.Drawing.Point(0x5f, 2);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0x35, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 0x59;
            this.Label1.Text = "Đến ng\x00e0y";
            this.TxtDenNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(0x62, 0x11);
            this.TxtDenNgay.Location = point;
            this.TxtDenNgay.Name = "TxtDenNgay";
            size = new Size(0x55, 20);
            this.TxtDenNgay.Size = size;
            this.TxtDenNgay.TabIndex = 0x58;
            this.Label13.AutoSize = true;
            this.Label13.BackColor = Color.Transparent;
            point = new System.Drawing.Point(6, 2);
            this.Label13.Location = point;
            this.Label13.Name = "Label13";
            size = new Size(0x2e, 13);
            this.Label13.Size = size;
            this.Label13.TabIndex = 0x57;
            this.Label13.Text = "Từ ng\x00e0y";
            this.TxtTuNgay.Format = DateTimePickerFormat.Custom;
            point = new System.Drawing.Point(9, 0x11);
            this.TxtTuNgay.Location = point;
            this.TxtTuNgay.Name = "TxtTuNgay";
            size = new Size(0x53, 20);
            this.TxtTuNgay.Size = size;
            this.TxtTuNgay.TabIndex = 0x56;
            this.CmdPrint.Image = ACCOUNTING.My.Resources.Resources.report;
            this.CmdPrint.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(0x330, 0x2b);
            this.CmdPrint.Location = point;
            this.CmdPrint.Name = "CmdPrint";
            size = new Size(0x54, 0x1a);
            this.CmdPrint.Size = size;
            this.CmdPrint.TabIndex = 0x54;
            this.CmdPrint.Text = "&Print";
            this.CmdPrint.UseVisualStyleBackColor = true;
            this.CmdOK.Image = (Image) manager.GetObject("CmdOK.Image");
            this.CmdOK.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(0x333, 9);
            this.CmdOK.Location = point;
            this.CmdOK.Name = "CmdOK";
            size = new Size(0x54, 0x1a);
            this.CmdOK.Size = size;
            this.CmdOK.TabIndex = 0x54;
            this.CmdOK.Text = "&Load";
            this.CmdOK.UseVisualStyleBackColor = true;
            this.CmdExel.Image = (Image) manager.GetObject("CmdExel.Image");
            this.CmdExel.ImageAlign = ContentAlignment.MiddleLeft;
            point = new System.Drawing.Point(0x38a, 9);
            this.CmdExel.Location = point;
            this.CmdExel.Name = "CmdExel";
            size = new Size(80, 0x1a);
            this.CmdExel.Size = size;
            this.CmdExel.TabIndex = 0x55;
            this.CmdExel.Text = "&Excel";
            this.CmdExel.UseVisualStyleBackColor = true;
            this.Panel2.Controls.Add(this.Panel3);
            this.Panel2.Controls.Add(this.VSlist);
            this.Panel2.Dock = DockStyle.Fill;
            point = new System.Drawing.Point(0, 0x2b);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x3e2, 0x275);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 0x4a;
            this.Panel3.BackgroundImage = (Image) manager.GetObject("Panel3.BackgroundImage");
            this.Panel3.Controls.Add(this.Panel4);
            this.Panel3.Dock = DockStyle.Bottom;
            point = new System.Drawing.Point(0, 0x250);
            this.Panel3.Location = point;
            this.Panel3.Name = "Panel3";
            size = new Size(0x3e2, 0x25);
            this.Panel3.Size = size;
            this.Panel3.TabIndex = 0x4b;
            this.Panel4.BackgroundImage = (Image) manager.GetObject("Panel4.BackgroundImage");
            this.Panel4.Controls.Add(this.txtTongTienHangHoa);
            this.Panel4.Controls.Add(this.Label3);
            this.Panel4.Controls.Add(this.TxtTongTienNguyenVatLieu);
            this.Panel4.Controls.Add(this.TxtTongSoTien);
            this.Panel4.Dock = DockStyle.Right;
            point = new System.Drawing.Point(0x267, 0);
            this.Panel4.Location = point;
            this.Panel4.Name = "Panel4";
            size = new Size(0x17b, 0x25);
            this.Panel4.Size = size;
            this.Panel4.TabIndex = 2;
            this.txtTongTienHangHoa.BorderStyle = BorderStyle.FixedSingle;
            this.txtTongTienHangHoa.FormatType = FormatTypeEnum.StandardNumber;
            point = new System.Drawing.Point(0x4d, 10);
            this.txtTongTienHangHoa.Location = point;
            this.txtTongTienHangHoa.Name = "txtTongTienHangHoa";
            this.txtTongTienHangHoa.ReadOnly = true;
            size = new Size(0x5e, 0x12);
            this.txtTongTienHangHoa.Size = size;
            this.txtTongTienHangHoa.TabIndex = 0;
            this.txtTongTienHangHoa.Tag = null;
            this.txtTongTienHangHoa.TextAlign = HorizontalAlignment.Right;
            this.txtTongTienHangHoa.VisibleButtons = DropDownControlButtonFlags.None;
            this.txtTongTienHangHoa.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.txtTongTienHangHoa.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.Label3.AutoSize = true;
            this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new System.Drawing.Point(3, 12);
            this.Label3.Location = point;
            this.Label3.Name = "Label3";
            size = new Size(0x44, 13);
            this.Label3.Size = size;
            this.Label3.TabIndex = 1;
            this.Label3.Text = "Tổng cộng";
            this.TxtTongTienNguyenVatLieu.BorderStyle = BorderStyle.FixedSingle;
            this.TxtTongTienNguyenVatLieu.FormatType = FormatTypeEnum.StandardNumber;
            point = new System.Drawing.Point(0xb1, 10);
            this.TxtTongTienNguyenVatLieu.Location = point;
            this.TxtTongTienNguyenVatLieu.Name = "TxtTongTienNguyenVatLieu";
            this.TxtTongTienNguyenVatLieu.ReadOnly = true;
            size = new Size(0x5e, 0x12);
            this.TxtTongTienNguyenVatLieu.Size = size;
            this.TxtTongTienNguyenVatLieu.TabIndex = 0;
            this.TxtTongTienNguyenVatLieu.Tag = null;
            this.TxtTongTienNguyenVatLieu.TextAlign = HorizontalAlignment.Right;
            this.TxtTongTienNguyenVatLieu.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtTongTienNguyenVatLieu.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongTienNguyenVatLieu.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongSoTien.BorderStyle = BorderStyle.FixedSingle;
            this.TxtTongSoTien.FormatType = FormatTypeEnum.StandardNumber;
            point = new System.Drawing.Point(0x115, 10);
            this.TxtTongSoTien.Location = point;
            this.TxtTongSoTien.Name = "TxtTongSoTien";
            this.TxtTongSoTien.ReadOnly = true;
            size = new Size(0x5e, 0x12);
            this.TxtTongSoTien.Size = size;
            this.TxtTongSoTien.TabIndex = 0;
            this.TxtTongSoTien.Tag = null;
            this.TxtTongSoTien.TextAlign = HorizontalAlignment.Right;
            this.TxtTongSoTien.VisibleButtons = DropDownControlButtonFlags.None;
            this.TxtTongSoTien.VisualStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            this.TxtTongSoTien.VisualStyleBaseStyle = C1.Win.C1Input.VisualStyle.Office2007Blue;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x3e2, 0x2a0);
            this.ClientSize = size;
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.Panel1);
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            this.Name = "Frm_RptSoNhatKyMuaHang";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Tag = "BC-0100   ";
            this.Text = "SO NHAT KY MUA HANG";
            this.VSlist.EndInit();
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.Panel2.ResumeLayout(false);
            this.Panel3.ResumeLayout(false);
            this.Panel4.ResumeLayout(false);
            this.Panel4.PerformLayout();
            ((ISupportInitialize) this.txtTongTienHangHoa).EndInit();
            ((ISupportInitialize) this.TxtTongTienNguyenVatLieu).EndInit();
            ((ISupportInitialize) this.TxtTongSoTien).EndInit();
            this.ResumeLayout(false);
        }

        public void MergeColumns()
        {
            this.VSlist[0, 0] = "Ng\x00e0y th\x00e1ng ghi sổ";
            this.VSlist[1, 0] = "Ng\x00e0y th\x00e1ng ghi sổ";
            this.VSlist[2, 0] = "Ng\x00e0y th\x00e1ng ghi sổ";
            this.VSlist[3, 0] = "A";
            this.VSlist[3, 1] = "B";
            this.VSlist[3, 2] = "C";
            this.VSlist[3, 3] = "D";
            this.VSlist[3, 4] = "1";
            this.VSlist[3, 5] = "2";
            this.VSlist[3, 6] = "E";
            this.VSlist[3, 7] = "3";
            this.VSlist[3, 8] = "4";
            this.VSlist[0, 1] = "Chứng từ";
            this.VSlist[0, 2] = "Chứng từ";
            this.VSlist[1, 1] = "Số hiệu";
            this.VSlist[2, 1] = "Số hiệu";
            this.VSlist[1, 2] = "Ng\x00e0y th\x00e1ng";
            this.VSlist[2, 2] = "Ng\x00e0y th\x00e1ng";
            this.VSlist[0, 3] = "Diễn giải";
            this.VSlist[1, 3] = "Diễn giải";
            this.VSlist[2, 3] = "Diễn giải";
            this.VSlist[0, 4] = "T\x00e0i khoản ghi nợ";
            this.VSlist[0, 5] = "T\x00e0i khoản ghi nợ";
            this.VSlist[0, 6] = "T\x00e0i khoản ghi nợ";
            this.VSlist[0, 7] = "T\x00e0i khoản ghi nợ";
            this.VSlist[1, 4] = "H\x00e0ng h\x00f3a";
            this.VSlist[2, 4] = "H\x00e0ng h\x00f3a";
            this.VSlist[1, 5] = "Nguy\x00ean vật liệu";
            this.VSlist[2, 5] = "Nguy\x00ean vật liệu";
            this.VSlist[1, 6] = "T\x00e0i khoản kh\x00e1c";
            this.VSlist[1, 7] = "T\x00e0i khoản kh\x00e1c";
            this.VSlist[2, 6] = "Số hiệu";
            this.VSlist[2, 7] = "Số tiền";
            this.VSlist[0, 8] = "Phải trả người b\x00e1n (Ghi C\x00f3)";
            this.VSlist[1, 8] = "Phải trả người b\x00e1n (Ghi C\x00f3)";
            this.VSlist[2, 8] = "Phải trả người b\x00e1n (Ghi C\x00f3)";
            this.VSlist.Cols[0].AllowMerging = true;
            this.VSlist.Cols[1].AllowMerging = true;
            this.VSlist.Cols[2].AllowMerging = true;
            this.VSlist.Cols[3].AllowMerging = true;
            this.VSlist.Cols[4].AllowMerging = true;
            this.VSlist.Cols[5].AllowMerging = true;
            this.VSlist.Cols[8].AllowMerging = true;
            this.VSlist.Rows[0].AllowMerging = true;
            this.VSlist.Rows[1].AllowMerging = true;
            this.VSlist.AllowMerging = AllowMergingEnum.FixedOnly;
            this.VSlist.Styles.Fixed.WordWrap = true;
            int num2 = this.VSlist.Cols.Count - 1;
            for (int i = 0; i <= num2; i++)
            {
                this.VSlist.Cols[i].TextAlignFixed = TextAlignEnum.CenterCenter;
            }
            this.VSlist.Cols[0].Width = 0x41;
            this.VSlist.Cols[1].Width = 90;
            this.VSlist.Cols[2].Width = 70;
            this.VSlist.Cols[3].Width = 350;
            this.VSlist.Cols[4].Width = 80;
            this.VSlist.Cols[5].Width = 80;
            this.VSlist.Cols[6].Width = 80;
            this.VSlist.Cols[7].Width = 80;
            this.VSlist.Cols[8].Width = 70;
        }

        private void pd_PrintPage(object sender, PrintPageEventArgs e)
        {
            string str;
            Graphics graphics = e.Graphics;
            if ((LVYModule.sLeft(this.TxtTuNgay.Text, 5) == "01/01") & (LVYModule.sLeft(this.TxtDenNgay.Text, 5) == "31/12"))
            {
                str = modGeneral.Tranlated("Năm", "") + " " + LVYModule.sRight(this.TxtTuNgay.Text, 4);
            }
            else
            {
                str = modGeneral.Tranlated("Từ ng\x00e0y", "") + " :" + this.TxtTuNgay.Text + " " + modGeneral.Tranlated("đến ng\x00e0y", "") + ":" + this.TxtDenNgay.Text;
            }
            graphics.DrawString("Đơn vị : " + modGeneral.H_COMPANYNAMEVIET, new System.Drawing.Font("Arial", 10f, FontStyle.Bold), Brushes.Black, (float) 120f, (float) 50f);
            graphics.DrawString("Địa chỉ : " + modGeneral.H_ADDRESSVIET, new System.Drawing.Font("Arial", 10f, FontStyle.Bold), Brushes.Black, (float) 120f, (float) 70f);
            graphics.DrawString("Mẫu số S03a43-DN", new System.Drawing.Font("Arial", 10f, FontStyle.Bold), Brushes.Black, (float) 850f, (float) 50f);
            graphics.DrawString("(Ban h\x00e0nh theo QĐ số 15/2006/QĐ-BTC", new System.Drawing.Font("Arial", 10f, FontStyle.Regular), Brushes.Black, (float) 800f, (float) 70f);
            graphics.DrawString("ng\x00e0y 20/03/2006 của Bộ trưởng BTC)", new System.Drawing.Font("Arial", 10f, FontStyle.Regular), Brushes.Black, (float) 800f, (float) 90f);
            graphics.DrawString("SỔ NHẬT K\x00dd MUA H\x00c0NG", new System.Drawing.Font("Arial", 16f, FontStyle.Bold), Brushes.Black, (float) 450f, (float) 110f);
            graphics.DrawString(str, new System.Drawing.Font("Arial", 10f, FontStyle.Regular), Brushes.Black, (float) 500f, (float) 140f);
            graphics.DrawString("Đơn vị t\x00ednh : đ", new System.Drawing.Font("Arial", 10f, FontStyle.Regular), Brushes.Black, (float) 900f, (float) 145f);
        }

        public void Print()
        {
            PrintDocument printDocument = this.VSlist.PrintParameters.PrintDocument;
            PageSettings defaultPageSettings = printDocument.DefaultPageSettings;
            defaultPageSettings.Landscape = true;
            defaultPageSettings.Margins.Top = 0xaf;
            defaultPageSettings.Margins.Left = 100;
            defaultPageSettings.Margins.Right = 100;
            defaultPageSettings = null;
            printDocument.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            this.VSlist.PrintGrid("NKBH", PrintGridFlags.ShowPreviewDialog | PrintGridFlags.FitToPageWidth);
            MyProject.Forms.Frm_ViewReport2.ReportViewer.Document = printDocument;
            MyProject.Forms.Frm_ViewReport2.ShowDialog();
        }

        public void ShowData()
        {
            this.Cursor = Cursors.WaitCursor;
            System.Data.DataTable data = new System.Data.DataTable();
            int num = 0;
            data = this.GetData();
            if (data != null)
            {
                this.VSlist.Rows.Count = 4;
                int num2 = data.Rows.Count - 1;
                for (num = 0; num <= num2; num++)
                {
                    this.VSlist.AddItem("");
                    this.VSlist[num + 4, 0] = RuntimeHelpers.GetObjectValue(data.Rows[num]["NgayThang"]);
                    this.VSlist[num + 4, 1] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoHieu"]);
                    this.VSlist[num + 4, 2] = RuntimeHelpers.GetObjectValue(data.Rows[num]["NgayChungTu"]);
                    this.VSlist[num + 4, 3] = RuntimeHelpers.GetObjectValue(data.Rows[num]["DienGiai"]);
                    if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[num]["TaiKhoanNo"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim().Contains("156"))
                    {
                        this.VSlist[num + 4, 4] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoTien"]);
                    }
                    else if (LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(data.Rows[num]["TaiKhoanNo"]), "", modGeneral.TypeOfValue.Nothing).ToString().Trim().Contains("152"))
                    {
                        this.VSlist[num + 4, 5] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoTien"]);
                    }
                    else
                    {
                        this.VSlist[num + 4, 6] = RuntimeHelpers.GetObjectValue(data.Rows[num]["TaiKhoanNo"]);
                        this.VSlist[num + 4, 7] = RuntimeHelpers.GetObjectValue(data.Rows[num]["SoTien"]);
                    }
                    this.VSlist[num + 4, 8] = RuntimeHelpers.GetObjectValue(data.Rows[num]["TaiKhoanCo"]);
                }
                this.txtTongTienHangHoa.Value = LVYModule.SumColGrid(this.VSlist, 4);
                this.TxtTongTienNguyenVatLieu.Value = LVYModule.SumColGrid(this.VSlist, 5);
                this.TxtTongSoTien.Value = LVYModule.SumColGrid(this.VSlist, 7);
                this.Cursor = Cursors.Default;
            }
        }

        internal virtual ADVAccount AdvTaiKhoan
        {
            [DebuggerNonUserCode]
            get
            {
                return this._AdvTaiKhoan;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._AdvTaiKhoan = value;
            }
        }

        internal virtual System.Windows.Forms.Button CmdExel
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdExel;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdExel_Click);
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click -= handler;
                }
                this._CmdExel = value;
                if (this._CmdExel != null)
                {
                    this._CmdExel.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdOK
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdOK;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdOK_Click);
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click -= handler;
                }
                this._CmdOK = value;
                if (this._CmdOK != null)
                {
                    this._CmdOK.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Button CmdPrint
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdPrint;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdPrint_Click);
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click -= handler;
                }
                this._CmdPrint = value;
                if (this._CmdPrint != null)
                {
                    this._CmdPrint.Click += handler;
                }
            }
        }

        internal virtual System.Windows.Forms.Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label13
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label13;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label13 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual System.Windows.Forms.Label Label3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label3 = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual Panel Panel3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel3 = value;
            }
        }

        internal virtual Panel Panel4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel4 = value;
            }
        }

        internal virtual DateTimePicker TxtDenNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtDenNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtDenNgay = value;
            }
        }

        internal virtual C1NumericEdit TxtTongSoTien
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTongSoTien;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTongSoTien = value;
            }
        }

        internal virtual C1NumericEdit txtTongTienHangHoa
        {
            [DebuggerNonUserCode]
            get
            {
                return this._txtTongTienHangHoa;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._txtTongTienHangHoa = value;
            }
        }

        internal virtual C1NumericEdit TxtTongTienNguyenVatLieu
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTongTienNguyenVatLieu;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTongTienNguyenVatLieu = value;
            }
        }

        internal virtual DateTimePicker TxtTuNgay
        {
            [DebuggerNonUserCode]
            get
            {
                return this._TxtTuNgay;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._TxtTuNgay = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

